﻿#region Header

/*
    This file is part of ndoctor-statistics.

    ndoctor-statistics is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    ndoctor-statistics is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with ndoctor-statistics.  If not, see <http://www.gnu.org/licenses/>.
*/

#endregion Header

namespace Probel.NDoctor.Statistics
{
    using System;

    using Probel.NDoctor.Statistics.Domain;

    /// <summary>
    /// Provides queries that returns only one result
    /// </summary>
    public interface IScalarQuery
    {
        #region Methods

        /// <summary>
        /// Counts the active application. A application is active when a user used the application at lease one time this last week.
        /// </summary>
        /// <param name="lastActivity">If the user logged statistics withing the specified number of days, it is selected.</param>
        /// <returns>
        /// The count of active users
        /// </returns>
        double GetActiveApplicationCount(int lastActivity = 14);

        /// <summary>
        /// Gets the application by app key.
        /// </summary>
        /// <param name="appKey">The app key.</param>
        /// <returns>
        /// The application or null if doesn't exist
        /// </returns>
        Application GetApplicationByAppKey(Guid appKey);

        /// <summary>
        /// Counts the application registered in the database.
        /// </summary>
        /// <returns></returns>
        double GetApplicationCount();

        /// <summary>
        /// Gets the average execution time of a method of a component.
        /// </summary>
        /// <returns>The average execution time of the methods</returns>
        double GetAvgExecutionTime();

        /// <summary>
        /// Gets the count of durations.
        /// </summary>
        /// <returns></returns>
        double GetDurationCount();

        /// <summary>
        /// Gets the first inscription.
        /// </summary>
        /// <returns>The date of the first inscription</returns>
        DateTime GetFirstInstallation();

        /// <summary>
        /// Gets the last inscription.
        /// </summary>
        /// <returns>The date of the last inscription</returns>
        DateTime GetLastInstallation();

        /// <summary>
        /// Get the date and the time of the last update.
        /// </summary>
        /// <returns>A <see cref="DateTime"/> representing the last update of the statistics</returns>
        DateTime GetLastUpdate();

        /// <summary>
        /// Gets the number of statistics entries contained in the database.
        /// </summary>
        /// <returns>The number of statistics entries in the database</returns>
        double GetStatisticsCount();

        #endregion Methods
    }
}